package cl.orangepeople.whyem.portal.negotiations.beans;

import cl.orangepeople.whyem.portal.backend.api.NegotiationsService;
import cl.orangepeople.whyem.portal.backend.dto.negotiations.NegotiationDataBean;
import cl.orangepeople.whyem.portal.negotiations.utils.whyemUtils;
import java.io.Serializable;
import java.util.List;
import javax.annotation.Resource;
import javax.inject.Named;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Scope;

@Named("negotiationsListBean")
@Scope("view")
public class NegotiationsListBean implements Serializable {

    private static Logger logger = LoggerFactory.getLogger(NegotiationsListBean.class);
    private List<NegotiationDataBean> negotiationsList;
    @Resource(name = "negotiationService")
    private NegotiationsService negotiationsService;

    public void initLoadNegotiationBean() {
        this.negotiationsList = loadNegotiations();
    }

    public List<NegotiationDataBean> loadNegotiations() {
        return negotiationsService.getNegotiationsByClientID(whyemUtils.getUserClientID());
    }

    public List<NegotiationDataBean> getNegotiationsList() {
        return negotiationsList;
    }

    public void setNegotiationsList(List<NegotiationDataBean> negotiationsList) {
        this.negotiationsList = negotiationsList;
    }
}